package dkbta.ontology.elements.primitive;

import java.sql.PreparedStatement;
import java.sql.SQLException;

import dkbta.ontology.elements.Element;
import dkbta.ontology.elements.ElementType;
import dkbta.ontology.values.ValuesType;
import dkbta.util.time.TimeInterval;

public class Primitive extends Element{
	/**
	 * Initializes a primitive instance with the given parameters
	 * 
	 * @param name The element's name
	 * @param startTime The element's start time
	 * @param endTime The element's end time
	 * @param value The value of the element (numeric or symbolic)
	 * @param valueType The type of the value symbolic (String) or numeric (Double)
	 */
	public Primitive(String name, long startTime, long endTime, Object value,
		ValuesType valueType){
		super(ElementType.PRIMITIVE, name, startTime, endTime, value, valueType);
	}

	/**
	 * Initializes a primitive instance with the given parameters
	 * 
	 * @param name The element's name
	 * @param timeInterval The time interval
	 * @param value The value of the element (numeric or symbolic)
	 * @param valueType The type of the value symbolic (String) or numeric (Double)
	 */
	public Primitive(String name, TimeInterval timeInterval, Object value,
		ValuesType valueType){
		super(ElementType.PRIMITIVE, name, timeInterval, value, valueType);
	}

	@Override
	public void insertDataIntoPS(PreparedStatement ps, int valueIndex, int typeIndex)
			throws SQLException{
		ps.setString(valueIndex, String.valueOf(_value));
		ps.setString(typeIndex, "PRIMITIVE");
	}
}
